/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gestion;

import laboratorio.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Juan Antonio Tirado
 */
@Entity
@Table(name = "albaran_factura", catalog = "lpd", schema = "")
@NamedQueries({@NamedQuery(name = "AlbaranFactura.findAll", query = "SELECT a FROM AlbaranFactura a"), @NamedQuery(name = "AlbaranFactura.findByIDalbaran", query = "SELECT a FROM AlbaranFactura a WHERE a.albaranFacturaPK.iDalbaran = :iDalbaran"), @NamedQuery(name = "AlbaranFactura.findByIDfactura", query = "SELECT a FROM AlbaranFactura a WHERE a.albaranFacturaPK.iDfactura = :iDfactura")})
public class AlbaranFactura implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected AlbaranFacturaPK albaranFacturaPK;

    public AlbaranFactura() {
    }

    public AlbaranFactura(AlbaranFacturaPK albaranFacturaPK) {
        this.albaranFacturaPK = albaranFacturaPK;
    }

    public AlbaranFactura(int iDalbaran, int iDfactura) {
        this.albaranFacturaPK = new AlbaranFacturaPK(iDalbaran, iDfactura);
    }

    public AlbaranFacturaPK getAlbaranFacturaPK() {
        return albaranFacturaPK;
    }

    public void setAlbaranFacturaPK(AlbaranFacturaPK albaranFacturaPK) {
        this.albaranFacturaPK = albaranFacturaPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (albaranFacturaPK != null ? albaranFacturaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AlbaranFactura)) {
            return false;
        }
        AlbaranFactura other = (AlbaranFactura) object;
        if ((this.albaranFacturaPK == null && other.albaranFacturaPK != null) || (this.albaranFacturaPK != null && !this.albaranFacturaPK.equals(other.albaranFacturaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "laboratorio.AlbaranFactura[albaranFacturaPK=" + albaranFacturaPK + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
